package org.visionlibrary.image.filters.effects;

public class Posterize {
	protected int levels = 6;

	public Posterize() {
		this(6);
	}

	public Posterize(int levels) {
		this.levels = levels;
	}

	public int getLevels() {
		return levels;
	}

	public void setLevels(int levels) {
		this.levels = levels;
	}

	public int[] getLut() {
//		ColorModel cm = src.getColorModel();
//		int componentSize = cm.getComponentSize(ch);
//		int length = (int) Math.pow(2, componentSize);
		
		int[] lut = new int[256];
		if (levels != 1)
			for (int i = 0; i < 256; i++)
				lut[i] = 255 * (levels * i / 256) / (levels - 1);
		return lut;
	}
}
